function Entity()
{

  this.entities = new Array();


  // loads the new source
  this.loadEntityClass = function(entityClass)
  {
    newElement = document.createElement("script");
    newElement.setAttribute("type","text/javascript");
    newElement.setAttribute("src", "js/libs/" + entityClass + ".js");
    document.getElementsByTagName("head")[0].appendChild(newElement);
  }


  // loads specified entitiy into the enties array
  this.addEntity = function(entityClass, entityID)
  {
    console.log("Loading new entity >> " + entityClass);

    // create array if doesnt exists
    if (this.entities[entityClass] === undefined) {
      this.entities[entityClass] = new Array();
      this.loadEntityClass(entityClass);
    }

    // static fabrication methods for each entity
    switch (entityClass)
    {
    case "GameManager" :
      this.entities[entityClass][this.entities[entityClass].length] = new GameManager();
      break;
    case "InputManager" :
      this.entities[entityClass][this.entities[entityClass].length] = new InputManager();
      break;
    case "RenderManager" :
      this.entities[entityClass][this.entities[entityClass].length] = new RenderManager();
      break;
    case "PlayerCamera" :
      this.entities[entityClass][this.entities[entityClass].length] = new PlayerCamera();
      break;
    case "PlayerModel" :
      this.entities[entityClass][this.entities[entityClass].length] = new PlayerModel();
      break;
    case "KeyboardInput" :
      this.entities[entityClass][this.entities[entityClass].length] = new KeyboardInput();
      break;
    case "MouseInput" :
      this.entities[entityClass][this.entities[entityClass].length] = new MouseInput();
      break;
    case "Viewport" :
      this.entities[entityClass][this.entities[entityClass].length] = new Viewport();
      break;
    case "Sprite" :
      this.entities[entityClass][this.entities[entityClass].length] = new Sprite();
      break;
    case "Tile" :
      this.entities[entityClass][this.entities[entityClass].length] = new Tile();
      break;
    case "TileMap" :
      this.entities[entityClass][this.entities[entityClass].length] = new TileMap();
      break;
    case "RenderText" :
      this.entities[entityClass][this.entities[entityClass].length] = new RenderText();
      break;
    default:
        console.log("... failed.");
    }

    this.entities[entityClass][this.entities[entityClass].length - 1].init();

    if (entityID !== undefined) {
      this[entityID] = new Array();
      this[entityID] = this.entities[entityClass][this.entities[entityClass].length - 1]
    }

  }


}